import 'package:flutter/material.dart';
import 'package:hook_up_rent/pages/home/tab_index/index_recommend_data.dart';
import 'package:hook_up_rent/widgets/common_image.dart';

class IndexRecommandItemWidget extends StatelessWidget {
  final IndexRecommendItem data;
  const IndexRecommandItemWidget({super.key, required this.data});

  @override
  Widget build(BuildContext context) {
    const textStyle = TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600);
    return GestureDetector(
      onTap: () => {Navigator.of(context).pushNamed(data.navigateUrl)},
      child: Container(
        width: (MediaQuery.of(context).size.width - 10.0 * 3) / 2,
        height: 100.0,
        padding: const EdgeInsets.all(10.0),
        decoration: const BoxDecoration(color: Colors.white),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Text(data.title, style: textStyle),
                Text(data.subTitle, style: textStyle)
              ],
            ),
            CommonImage(
              data.imageUrl,
              width: 55.0,
            )
          ],
        ),
      ),
    );
  }
}
